My Visualization

The Gross Domestic Product (GDP) of a country has four components: private consumption (private spending on goods and services), investment, net exports (total exports minus total imports), and government spending (public spending on goods and services).

On the plot, each of the four components are shown for each year as a proportion of the whole GDP. For a given year, the four proportions add up to one.

Notice that net exports is sometimes negative. This means that, in that year, the value of the imports into the USA was greater than the value of the exports out of the USA, otherwise known as a trade deficit.

Data Source

The data was collected by the United States Bureau of Labor Statistics.

Reflection

One idea from Wilke’s book that I took into consideration was Chapter 10 on visualizing proportions. My original idea for this data was to show a pie chart for each year. However, I realized that that wouldn’t be the best idea in this situation. I also considered using stacked bars instead of grouped bars. This was not feasible due to net exports being negative for many of the years.

An additional thing that I would like to do with this data is show how total nominal GDP changed over this time period. I was able to put the nominal value in the tooltip for each data point, in addition to the proportion. However, in sticking to just one visualization, I couldn’t show this graphically. You would see that the nominal GDP of the USA has risen exponentially over the last 90 years or so.

One technical challenge that I had was creating the buttons. It was difficult to get them in the right spot and to have them change the right aspects of the plot. In general, placement of the different objects on the plot was a bit weird. The scale for x and y arguments in Plotly is [-2, 3]. I’d like to hear the rationale for that scale.